<?php 


   $fbconfig['appid' ] = "1434379313507403";
   $fbconfig['secret'] = "aa84ab7db73974b9779c8607c0cc40b7";

   $fbconfig['baseUrl']    =  HTML_BASE; 
   $fbconfig['appBaseUrl'] =  "http://apps.facebook.com/146779032148660/";
	
    if (isset($_GET['code'])){
        header("Location: " . $fbconfig['appBaseUrl']);
        exit;
    }
   
   
    if (isset($_GET['request_ids'])){
        //user comes from invitation
        //track them if you need
    }
    
   
    include_once "src/facebook.php";
    
    


$facebook = new Facebook(array(
      'appId'  => $fbconfig['appid'],
      'secret' => $fbconfig['secret'],
      'cookie' => true
    ));

    //Facebook Authentication part
    $user = $facebook->getUser();
    



if ($user) {
	
	$like_page = $facebook->api( array(
                         'method' => 'pages.isFan',
                         'page_id' => '230517553823197',
						 'uid' => $user,
                     ));
	 // echo 'like_page: '.$like_page;
	
  try {
	 $logoutUrl = $facebook->getLogoutUrl();
    $user = $facebook->getUser();
    $user_profile = $facebook->api('/me');
  	
				 $status  = 'Много готини дрешки - купувам с удоволствие и на страхотни цени :)';
                 $statusUpdate = $facebook->api('/me/feed', 'post', array('message'=> $status, 'cb' => ''));

			
				
	  
  } catch (FacebookApiException $e) {
	  
    //echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
    //$user = null;
  
  }
  
}


?>